/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/

package com.cea.papyrus.diagram.component.helper;

import org.eclipse.uml2.uml.Component;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLFactory;

import com.cea.papyrus.core.utils.Debug;


/**
 * @author AL090761
 *
 */
public class NodeInstanceSpecificationHelper extends com.cea.papyrus.diagram.classdiagram.helper.NodeInstanceSpecificationHelper {

	/**
	 * 
	 */
	public NodeInstanceSpecificationHelper() {
		// TODO Auto-generated constructor stub
	}
	/**
	 * 
	 * 
	 * @param umlParent 
	 * @param name 
	 * 
	 * @return 
	 */
	@Override
	public org.eclipse.uml2.uml.Element createUMLElement(String name, org.eclipse.uml2.uml.Element umlParent) {
		Debug.debug(this,"Call NodeInstanceSpecificationFactory.createInstanceSpecification()", channel);
		// create InstanceSepcification
		org.eclipse.uml2.uml.InstanceSpecification anInstanceSpecification = UMLFactory.eINSTANCE.createInstanceSpecification();
		anInstanceSpecification.setName(name);
		((Package)umlParent).getPackagedElements().add(anInstanceSpecification);
		return anInstanceSpecification;
	}
	
	/* (non-Javadoc)
	 * @see com.cea.papyrus.common.factories.NodeFactory#canExecuteCreateElement(org.eclipse.uml2.uml.Element)
	 */
	/**
	 * 
	 * 
	 * @param umlParent 
	 * 
	 * @return 
	 */
	public boolean canCreateUMLElement(Element umlParent) {
		if( (umlParent instanceof Component) ||
				(umlParent instanceof Package)) {
			return true;
		}
		return false;
	}
	
}
